client/python: add OpenAI-compatible REST API samples#4096
Open
retryoos wants to merge 1 commit intoopenvinotoolkit:mainfrom
Open
client/python: add OpenAI-compatible REST API samples#4096retryoos wants to merge 1 commit intoopenvinotoolkit:mainfrom
retryoos wants to merge 1 commit intoopenvinotoolkit:mainfrom
Conversation
ngrozae
reviewed
Apr 3, 2026
Comment on lines
+158
to
+161
| Sends a streaming request to the OpenVINO Model Server OpenAI-compatible chat/completions endpoint | ||
| and prints generated tokens as they arrive. | ||
|
|
||
| optional arguments: |
Collaborator
There was a problem hiding this comment.
help output differs:
Suggested change
| Sends a streaming request to the OpenVINO Model Server OpenAI-compatible chat/completions endpoint | |
| and prints generated tokens as they arrive. | |
| optional arguments: | |
| Sends a streaming request to the OpenVINO Model Server OpenAI-compatible | |
| chat/completions endpoint and prints tokens as they arrive. | |
| options: |
ngrozae
reviewed
Apr 3, 2026
| "index": 0, | ||
| "logprobs": null, | ||
| "message": { | ||
| "content": "The capital of France is Paris.", |
Collaborator
There was a problem hiding this comment.
content differs in test:
Suggested change
| "content": "The capital of France is Paris.", | |
| "content": "The capital of France is Paris. It is not only the largest city in France but also serves as the country's political, cultural, and economic center. Paris is known for its landmarks such as the Eiffel Tower, Notre-Dame Cathedral, and the Louvre Museum, which is the world's largest art museum and a historic monument in Paris.", |
please move command output to separate quotes with 'text' mark instead of 'bash'
ngrozae
reviewed
Apr 3, 2026
| } | ||
| ], | ||
| "created": 1743000000, | ||
| "model": "ovms-model", |
Collaborator
There was a problem hiding this comment.
content differs in test:
Suggested change
| "model": "ovms-model", | |
| "model": "Phi-3-mini", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🛠 Summary
JIRA/Issue if applicable: N/A (small Python client samples addition)
This PR adds OpenAI-compatible REST API Python samples under
client/python/openai-api/samples/and links them fromclient/python/README.md.Added:
http_list_models.pyforGET /v3/modelshttp_chat_completions.pyfor unaryPOST /v3/chat/completionshttp_chat_completions_stream.pyfor streamingPOST /v3/chat/completions(stream: true, SSE parsing)README.mdwith setup, usage, and examplesrequirements.txt(stdlib-only note)Updated:
client/python/README.mdwith a link to the new OpenAI API samples sectionNotes:
python3 -m py_compileand--helpchecks for all scripts.🧪 Checklist